package net.sf.midollo.net.protocol.echo;

import java.io.IOException;

import net.sf.midollo.io.IOStream;
import net.sf.midollo.io.IOStreamConnector;
import net.sf.midollo.net.protocol.Protocol;

public class Echo implements Protocol {

  public static final int DEFAULT_BUFFER_SIZE = 8 * 1024;

  protected final IOStreamConnector ioConnector;

  public Echo(IOStream ioSrc) throws IOException {
    this(ioSrc, DEFAULT_BUFFER_SIZE);
  }

  public Echo(IOStream ioSrc, int bufSize) throws IOException {
    this.ioConnector = new IOStreamConnector(ioSrc, bufSize);
  }

  public IOException getError() {
    return this.ioConnector.getError();
  }

  public void run() {
    this.ioConnector.run();
  }

  public void disconnect() throws IOException {
  }
}
